package com.xuetang9.cloud.house.agency.web;

import com.xuetang9.cloud.house.domain.VO.AgentAndUserVO;
import com.xuetang9.cloud.house.domain.VO.PropertiesAndRentTypeVO;
import com.xuetang9.cloud.house.domain.entity.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;


@Controller
public class AgenciesController {
    @RequestMapping("agency.html")
    public String agencies(ModelMap modelMap){
        modelMap.put("title","房产系统-房产代理");

        return "agencies";
    }

    @RequestMapping("agency-details.html")
    public String agencyDetails(ModelMap modelMap){

        /* 1.公司信息*/
        Template template = new Template();
        template.setName("1Royao Estates");
        template.setBrief("2Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni, fugit. Quibusdam eveniet voluptate minima, est veritatis ea quod expedita facere harum tempore sapiente maxime recusandae quisquam cupiditate beatae nihil deserunt eum incidunt, porro rerum doloribus cum. Magnam quia voluptates quae?");
        template.setCompanyAddress("3246, 2st AVE, Manchester 126 , Noth England");
        template.setConcatPhoneOne("4(756) 447 5744");
        template.setConcatMail("5info@example.com");
        template.setCompanyWeb("6www.example.com");
        template.setIcp("7AB7876A6");

        /* 2.代理人展示*/
        List<AgentAndUserVO> agentAndUserVOS = new ArrayList<>();

        // 第1个数据
        AgentAndUserVO agentAndUserVO1 = new AgentAndUserVO();
        Agent agent1 = new Agent();
        User user1 = new User();
        // 添加代理人邮箱
        agent1.setEmail("1info@example.com");
        // 添加姓名和电话
        user1.setName("尼古拉斯凯奇1");
        user1.setPhone("13775981131");

        // 添加视图数据
        agentAndUserVO1.setAgent(agent1);
        agentAndUserVO1.setUser(user1);
        agentAndUserVOS.add(agentAndUserVO1);

        // 第2个数据
        AgentAndUserVO agentAndUserVO2 = new AgentAndUserVO();
        Agent agent2 = new Agent();
        User user2 = new User();
        // 添加代理人邮箱
        agent2.setEmail("2info@example.com");
        // 添加姓名和电话
        user2.setName("尼古拉斯凯奇2");
        user2.setPhone("13775981132");

        // 添加视图数据
        agentAndUserVO2.setAgent(agent2);
        agentAndUserVO2.setUser(user2);
        agentAndUserVOS.add(agentAndUserVO2);

        // 第3个数据
        AgentAndUserVO agentAndUserVO3 = new AgentAndUserVO();
        Agent agent3 = new Agent();
        User user3 = new User();
        // 添加代理人邮箱
        agent3.setEmail("3info@example.com");
        // 添加姓名和电话
        user3.setName("尼古拉斯凯奇3");
        user3.setPhone("13775981133");

        // 添加视图数据
        agentAndUserVO3.setAgent(agent3);
        agentAndUserVO3.setUser(user3);
        agentAndUserVOS.add(agentAndUserVO3);

        // 第3个数据
        AgentAndUserVO agentAndUserVO4 = new AgentAndUserVO();
        Agent agent4 = new Agent();
        User user4 = new User();
        // 添加代理人邮箱
        agent4.setEmail("3info@example.com");
        // 添加姓名和电话
        user4.setName("尼古拉斯凯奇4");
        user4.setPhone("13775981134");

        // 添加视图数据
        agentAndUserVO4.setAgent(agent4);
        agentAndUserVO4.setUser(user4);
        agentAndUserVOS.add(agentAndUserVO4);

        /* 3.房产展示*/
        List<PropertiesAndRentTypeVO> propertiesAndRentTypeVOS = new ArrayList<>();

        // 第1个数据
        PropertiesAndRentTypeVO propertiesAndRentTypeVO1 = new PropertiesAndRentTypeVO();
        Properties properties1 = new Properties();
        PropertiesRentType propertiesRentType1 = new PropertiesRentType();
        // 添加房产标题、地址、价格、面积、房间数、卫生间数、车位数
        properties1.setTitle("全景别墅1");
        properties1.setAddress("成都市西部国际金融中心2栋1");
        properties1.setPrice(100f);
        properties1.setSquare(100f);
        properties1.setRoomNumber(1);
        properties1.setBathroomNumber(1);
        properties1.setGarageNumber(1);
        // 添加房产租售类型
        propertiesRentType1.setTypeName("出租");

        propertiesAndRentTypeVO1.setProperties(properties1);
        propertiesAndRentTypeVO1.setPropertiesRentType(propertiesRentType1);
        propertiesAndRentTypeVOS.add(propertiesAndRentTypeVO1);

        // 第2个数据
        PropertiesAndRentTypeVO propertiesAndRentTypeVO2 = new PropertiesAndRentTypeVO();
        Properties properties2 = new Properties();
        PropertiesRentType propertiesRentType2 = new PropertiesRentType();
        // 添加房产标题、地址、价格、面积、房间数、卫生间数、车位数
        properties2.setTitle("全景别墅2");
        properties2.setAddress("成都市西部国际金融中心2栋2");
        properties2.setPrice(200f);
        properties2.setSquare(200f);
        properties2.setRoomNumber(2);
        properties2.setBathroomNumber(2);
        properties2.setGarageNumber(2);
        // 添加房产租售类型
        propertiesRentType2.setTypeName("出租");

        propertiesAndRentTypeVO2.setProperties(properties2);
        propertiesAndRentTypeVO2.setPropertiesRentType(propertiesRentType2);
        propertiesAndRentTypeVOS.add(propertiesAndRentTypeVO2);

        // 第3个数据
        PropertiesAndRentTypeVO propertiesAndRentTypeVO3 = new PropertiesAndRentTypeVO();
        Properties properties3 = new Properties();
        PropertiesRentType propertiesRentType3 = new PropertiesRentType();
        // 添加房产标题、地址、价格、面积、房间数、卫生间数、车位数
        properties3.setTitle("全景别墅3");
        properties3.setAddress("成都市西部国际金融中心2栋3");
        properties3.setPrice(300f);
        properties3.setSquare(300f);
        properties3.setRoomNumber(3);
        properties3.setBathroomNumber(3);
        properties3.setGarageNumber(3);
        // 添加房产租售类型
        propertiesRentType3.setTypeName("出售");

        propertiesAndRentTypeVO3.setProperties(properties3);
        propertiesAndRentTypeVO3.setPropertiesRentType(propertiesRentType3);
        propertiesAndRentTypeVOS.add(propertiesAndRentTypeVO3);

        // 第4个数据
        PropertiesAndRentTypeVO propertiesAndRentTypeVO4 = new PropertiesAndRentTypeVO();
        Properties properties4 = new Properties();
        PropertiesRentType propertiesRentType4 = new PropertiesRentType();
        // 添加房产标题、地址、价格、面积、房间数、卫生间数、车位数
        properties4.setTitle("全景别墅4");
        properties4.setAddress("成都市西部国际金融中心2栋4");
        properties4.setPrice(400f);
        properties4.setSquare(400f);
        properties4.setRoomNumber(4);
        properties4.setBathroomNumber(4);
        properties4.setGarageNumber(4);
        // 添加房产租售类型
        propertiesRentType4.setTypeName("出租");

        propertiesAndRentTypeVO4.setProperties(properties4);
        propertiesAndRentTypeVO4.setPropertiesRentType(propertiesRentType4);
        propertiesAndRentTypeVOS.add(propertiesAndRentTypeVO4);

        // 第5个数据
        PropertiesAndRentTypeVO propertiesAndRentTypeVO5 = new PropertiesAndRentTypeVO();
        Properties properties5 = new Properties();
        PropertiesRentType propertiesRentType5 = new PropertiesRentType();
        // 添加房产标题、地址、价格、面积、房间数、卫生间数、车位数
        properties5.setTitle("全景别墅5");
        properties5.setAddress("成都市西部国际金融中心2栋5");
        properties5.setPrice(500f);
        properties5.setSquare(500f);
        properties5.setRoomNumber(5);
        properties5.setBathroomNumber(5);
        properties5.setGarageNumber(5);
        // 添加房产租售类型
        propertiesRentType5.setTypeName("出租");

        propertiesAndRentTypeVO5.setProperties(properties5);
        propertiesAndRentTypeVO5.setPropertiesRentType(propertiesRentType5);
        propertiesAndRentTypeVOS.add(propertiesAndRentTypeVO5);

        // 第6个数据
        PropertiesAndRentTypeVO propertiesAndRentTypeVO6 = new PropertiesAndRentTypeVO();
        Properties properties6 = new Properties();
        PropertiesRentType propertiesRentType6 = new PropertiesRentType();
        // 添加房产标题、地址、价格、面积、房间数、卫生间数、车位数
        properties6.setTitle("全景别墅6");
        properties6.setAddress("成都市西部国际金融中心2栋6");
        properties6.setPrice(600f);
        properties6.setSquare(600f);
        properties6.setRoomNumber(6);
        properties6.setBathroomNumber(6);
        properties6.setGarageNumber(6);
        // 添加房产租售类型
        propertiesRentType6.setTypeName("出租");

        propertiesAndRentTypeVO6.setProperties(properties6);
        propertiesAndRentTypeVO6.setPropertiesRentType(propertiesRentType6);
        propertiesAndRentTypeVOS.add(propertiesAndRentTypeVO6);

        /* 添加该页面的各版块VO数据*/
        modelMap.put("agencyCompanyInfo",template);  // 代理公司信息
        modelMap.put("agentAndUserVOS",agentAndUserVOS);  // 该公司下代理人信息
        modelMap.put("propertiesAndRentType",propertiesAndRentTypeVOS); // 名下房产信息
        return "agency-details";
    }
}
